package com.cyzy.esbean;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;


@JsonIgnoreProperties(ignoreUnknown =true)
//ES的索引库（数据库） 索引名<------------->
@Document(indexName = "contents_index",createIndex = false )
public class ContentsIndex implements Serializable {

  @Field(type= FieldType.Integer)
  private long id;
  //Keyword搜索需要设计哪些字段
  @Field(type= FieldType.Keyword)
  private String title;
  @Field(type= FieldType.Keyword)
  private String intro;
  @Field(type= FieldType.Text, analyzer = "ik_max_word")
  private String content;
  @Field(type= FieldType.Integer)
  private long createId;
  @Field(type= FieldType.Keyword)
  private String createName;
  @Field(type= FieldType.Date,format = DateFormat.date_hour_minute_second)
  private Date createTime;

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getIntro() {
    return intro;
  }

  public void setIntro(String intro) {
    this.intro = intro;
  }

  public String getContent() {
    return content;
  }

  public void setContent(String content) {
    this.content = content;
  }

  public long getCreateId() {
    return createId;
  }

  public void setCreateId(long createId) {
    this.createId = createId;
  }

  public String getCreateName() {
    return createName;
  }

  public void setCreateName(String createName) {
    this.createName = createName;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  @Override
  public String toString() {
    return "ContentsIndex{" +
            "id=" + id +
            ", title='" + title + '\'' +
            ", intro='" + intro + '\'' +
            ", content='" + content + '\'' +
            ", createId=" + createId +
            ", createName='" + createName + '\'' +
            ", createTime=" + createTime +
            '}';
  }
}
